Show:

CGSGHashmap Class

Module: Util

A Hashmap class.

Constructor

CGSGHashmap ()

Methods

addOrReplace
(
  • key
  • value
)

Add or replace the key in the map with the value.

Parameters:
Returns:
the index of the key in the map
containsKey
(
  • key
)
Boolean

Return true if the key already exists in the map

Parameters:
Returns:
getAt
(
  • index
)
Object
Parameters:
Returns:
Object: {key, value}
getKeyIndex
(
  • key
)
Number
Parameters:
Returns:
Number: The key index or -1 if not exists
getLength () Number

Return the number of keys in the map

Returns:
getValue
(
  • key
)
Object
Parameters:
Returns:
Object: the corresponding value or null if the key does not exist
remove
(
  • key
)
Parameters:
removeAll ()

Remove all keys in the map